package com.tuniu.agents.common.agent;

import com.tuniu.agents.advisor.AgentChatMemoryAdvisor;
import com.tuniu.agents.agent.AgentManager;
import com.tuniu.agents.agent.AgentManagerGroup;
import com.tuniu.agents.agent.AgentOptions;
import com.tuniu.agents.agent.OptionsAgent;
import com.tuniu.agents.message.MessageLogger;
import org.springframework.ai.chat.prompt.ChatOptions;

import java.util.stream.Collectors;

public class TripAgent extends OptionsAgent {

    protected final MessageLogger messageLogger;

    protected final AgentManager agentManager;
    


    public TripAgent(AgentManagerGroup agentManagerGroup, String agentId, String promptTemplateId, MessageLogger messageLogger,ChatOptions chatOptions) {
        super(agentManagerGroup, new AgentOptions(agentId, promptTemplateId,chatOptions));
        this.messageLogger = messageLogger;
        this.agentManager = agentManagerGroup.getAgentManager();
    }

    public TripAgent(AgentManagerGroup agentManagerGroup, String agentId, String promptTemplateId) {
        super(agentManagerGroup.getModelBuilder(),
                agentManagerGroup.getChatMemory(),
                agentManagerGroup.getAdvisors().stream().map(advisor -> advisor instanceof AgentChatMemoryAdvisor ? new AgentChatMemoryAdvisor(agentManagerGroup.getChatMemory(), false, false) : advisor).collect(Collectors.toList()),
                agentManagerGroup.getPromptManager(),
                agentManagerGroup.getChatEnvironmentMemory(),
                new AgentOptions(agentId, promptTemplateId));
        this.messageLogger = new MessageLogger(agentId);
        this.agentManager = agentManagerGroup.getAgentManager();
    }

    

    

}